Migrate Moodle™ from Other Providers
This article guides you how to migrate Moodle instance from other providers (called old instance for short) to cloud MClusters (called cloud instance for short).
Prerequisites
Before any operations, please get configuration files config.php on both instances. The value of the checked settings should be recorded for later use in the migration process.
Settings | Old Instance | Cloud Instance |
---|---|---|
$CFG->dbtype | √ | |
$CFG->dblibrary | √ | |
$CFG->dbhost | √ | |
$CFG->dbname | √ | √ |
$CFG->dbuser | √ | |
$CFG->dbpass | √ | |
$CFG->prefix | √ | |
$CFG->wwwroot | √ | |
$CFG->dataroot | √ | |
$CFG->admin | √ |
1. Back up old instance
1.1 Back up website files
We recommend using zip, and assume the backup file name is web_old.zip.
1.2 Back up data files
We recommend using zip, and assume the backup file name is data_old.zip.
1.3 Back up database
We recommend using mysqldump, and assume the backup file name is db_old.sql.
Note: The step has to be completed on the old instance. If you do not know how to operate, please contact your previous provider.
2. Transfer backups to cloud platform
Currently, 2 methods are available for file transfer: File Manager and FTPs. We recommend FTPs if the file size is over 50MB. Please get guides for both methods on the Guidance page on our Client Panel.
3. Restore site on cloud instance
3.1 Access CLI Console from the Shell/SSH page on our Client Panel
Note: Shell/SSH is available for verified customer account only. If the feature is greyed out, please complete your billing information first.
3.2 Restore website files and data files
Backup existing cloud instance files
mv /cloudclusters/moodle/html /cloudclusters/moodle/html_cloud mv /cloudclusters/moodle/moodledata /cloudclusters/moodle/moodledata_cloud
Restore old instance files
unzip /path/of/web_old.zip /cloudclusters/moodle/html unzip /path/of/data_old.zip /cloudclusters/moodle/moodledata
Note: If unzip is not recognized, please install it via command apt update && apt install -y unzip
.
Update configurations
mv /cloudclusters/moodle/html/config.php /cloudclusters/moodle/html/config_old.php cp /cloudclusters/moodle/html_cloud/config.php /cloudclusters/moodle/html/config.php
Update settings $CFG->prefix and $CFG->admin in config.php with values on old instance.
Update file owner
chown -R www-data:www-data /cloudclusters/moodle/html/ chown -R www-data:www-data /cloudclusters/moodle/moodledata/
3.3 Restore database
Backup the existing cloud instance database
Assume the backup file name is db_cloud.sql.
mysqldump -uadmin -p moodledatabase > /cloudclusters/moodle/html_cloud/db_cloud.sql
Restore old database
mysql -uadmin -p mysql> drop database moodledatabase; mysql> create database moodledatabase; mysql> use moodledatabase; mysql> source /path/of/db_old.sql
3.4 Restore domain and SSL settings
Add the domain name of the old instance, such as moodle.yourdomain.com, on the Site & SSL page on our Client Panel, and make it as primary.
Update DNS records from your name server.
Enable Free SSL once DNS propagation completes.